home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / AIAT 1.0.1 / Headers / Corpus / HFSIterator.h < prev    next >
Encoding:
Text File  |  1997-09-11  |  1.5 KB  |  66 lines  |  [TEXT/CWIE]

  1. // HFSIterator.h
  2. //    Copyright:    © 1994 - 1996 by Apple Computer, Inc., all rights reserved.
  3.  
  4. // a tool for efficiently implementing IADocIterator on HFS file systems
  5.  
  6. #pragma once
  7. #ifndef HFSIterator_h
  8. #define HFSIterator_h
  9.  
  10. #pragma import on
  11.  
  12. #include "IACommon.h"
  13.  
  14. //#pragma IA_BEGIN_IMPORTS
  15. #include <Files.h>
  16. //#pragma IA_END_IMPORTS
  17.  
  18. #pragma IA_BEGIN_EXPORTS
  19.  
  20. struct DirectoryInfo {
  21.     long        id;                                // the id
  22.     short        length;                            // the number of files
  23. private:
  24.     void*        operator new(size_t size);        // stack or array allocate only
  25. };
  26.  
  27.  
  28. class HFSIterator : public IAObject {
  29. public:
  30.                         HFSIterator(short vRefNum, long rootDirId = 2);
  31.                         ~HFSIterator();
  32.     bool                Increment();
  33.  
  34.     CInfoPBRec*         GetPBRec() const {return pb;}
  35.     
  36.     // Accessors needed to override Increment()
  37.     DirectoryInfo*        GetDirInfos() const {return dirInfos;}
  38.     long                GetDirCount() const {return dirCount;}
  39.     
  40.     uint32                GetDir() const {return dir;}
  41.     void                SetDir(uint32 newValue) {dir = newValue;}
  42.     
  43.     short                GetDirIndex() const {return dirIndex;}
  44.     void                SetDirIndex(short newValue) {dirIndex = newValue;}
  45.     
  46. protected:
  47.     
  48.     void                CollectDirInfo();
  49.  
  50. private:
  51.     void                CollectDirInfoInternal(uint32* dirInfosLen);
  52.     
  53.     CInfoPBRec*            pb;                    // info about current file
  54.     DirectoryInfo*        dirInfos;            // sorted array of directory ids for current volume
  55.     long                dirCount;            // length of dirInfos
  56.     uint32                dir;                // index in dirInfos of directory being processed
  57.     short                dirIndex;            // index into directory being processed
  58.  
  59. };
  60.  
  61. #pragma IA_END_EXPORTS
  62.  
  63. #pragma import reset
  64.  
  65. #endif
  66.